//
//  ACNetworkDemoVC.m
//  ACFramework_Example
//
//  Created by caoyq on 2018/12/15.
//  Copyright © 2018 honeycao. All rights reserved.
//

#import "ACNetworkDemoVC.h"
//#import "ACNetworking.h"
//#import "ACProgressHUD.h"
#import <ACFramework/ACNetworking.h>
#import <ACFramework/ACProgressHUD.h>

@interface ACNetworkDemoVC ()

@end

@implementation ACNetworkDemoVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [ACNetworkManager manager];
}

- (IBAction)didClickButton:(id)sender {
    
    NSString *url = @"http://www.yltest.cn/child/app/login.ashx";
    NSDictionary *param = @{@"username": @"主任",
                            @"pwd": @(802)
                            };
    NSString *vcName = NSStringFromClass([self class]);
    [ACProgressHUD showHUDWithText:@"登录中"];
    [ACNetworking getWithUrl:url vcName:vcName allHeaderFields:nil parameters:param success:^(id  _Nullable responseObject) {
        [ACProgressHUD hideHUDFromView:nil];
        [ACProgressHUD showText:@"登录成功"];
    } failure:^(NSError * _Nullable error) {
        [ACProgressHUD hideHUDFromView:nil];
        NSString *tip = error.userInfo[@"message"];
        [ACProgressHUD showText:tip];
    }];
}

@end
